package com.huike.web.controller.report;


import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IReportService reportService;

//    /**
//     * 首页--获取今日简报数据
//     */
//    @GetMapping("/getTodayInfo")
//    public AjaxResult getTodayInfo(){
//        return null;
//    }
//
//    /**
//     * 首页--获取待办数据
//     * @return
//     */
//    @GetMapping("/getTodoInfo")
//    public AjaxResult getTodoInfo(String beginCreateTime,String endCreateTime){
//        return null;
//    }

    /**
     * 首页--今日所有数据统计接口
     */
    @GetMapping
    public AjaxResult getTodayInfo(String beginCreateTime,
                                   String endCreateTime,
                                   Long deptId){
        return AjaxResult.success(reportService.getTodayInfo
                                    (beginCreateTime,
                                     endCreateTime,
                                     new SimpleDateFormat().format(new Date()),
                                            deptId)

        );
    }

    /**
     * 首页--商机转化龙虎榜接口
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/businessChangeStatistics")
    public AjaxResult businessChangeStatistics(String beginCreateTime,
                                               String endCreateTime,
                                               Long deptId){
        return null;
    }

    /**
     * 线索转化龙虎榜接口
     * @param beginCreateTime
     * @param endCreateTime
     * @param deptId
     * @return
     */
    @GetMapping("/salesStatistic")
    public AjaxResult salesStatistic(String beginCreateTime,
                                     String endCreateTime,
                                     Long deptId){
        return AjaxResult.success(reportService.getLeadConversion(beginCreateTime,endCreateTime));
    }

}
